//
//  KSFileFunc.m
//  KSLib
//
//  Created by User on 9/10/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "KSFileFunc.h"


@implementation KSFileFunc


//checking if a file exists
- (BOOL) isFileExits:(NSString *)prmFilePath{
    NSFileManager *filemng = [NSFileManager defaultManager];
    BOOL retResponse = [filemng fileExistsAtPath:prmFilePath];
    [filemng release];
    return retResponse;
}

//move or rename a file
- (BOOL) moveOrRenameFile:(NSString *)prmFromFilePath toPath:(NSString *) prmToFilePath{
    NSFileManager *filemng = [NSFileManager defaultManager];
    BOOL retResponse = [filemng moveItemAtPath:prmFromFilePath toPath:prmToFilePath error:NULL];
    [filemng release];
    return retResponse;
}

- (BOOL) deleteFile:(NSString *)prmFilePath{
    NSFileManager *filemng = [NSFileManager defaultManager];
    BOOL retResponse = [filemng removeItemAtPath:prmFilePath error:NULL];
    [filemng release];
    return retResponse; 
}

- (BOOL) copyFile:(NSString *)prmFromFilePath toPath:(NSString *) prmToFilePath{
    NSFileManager *filemng = [NSFileManager defaultManager];
    BOOL retResponse = [filemng copyItemAtPath:prmFromFilePath toPath:prmToFilePath error:NULL];
    [filemng release];
    return retResponse;
}

@end
